import {useMMKVString} from './useMMkv';
import {DarkTheme, LightTheme, ThemeType} from '@/theme';
import {Appearance, useColorScheme} from 'react-native';

export const useGetTheme = (): Exclude<ThemeType, 'system'> => {
  const [theme = 'light'] = useMMKVString<ThemeType>('theme');
  const colorScheme = useColorScheme();
  theme === 'system' && Appearance.setColorScheme(null);
  return theme === 'system' ? colorScheme! : theme;
};
export const useGetNaviTheme = () => {
  const theme = useGetTheme();
  return theme === 'light' ? LightTheme : DarkTheme;
};
